#include <stdio.h>


int main()
{
    char card1[4], card2[4],card3[4];
    int val1, val2, val3, sum, choose;

  do{
  printf("Let's play the game about 21 points，\n");

  printf("please input the first poker number  \n"); 
  scanf("%s",card1);
  
  switch(card1[0])
  {
      case'J':
      case'j':
      case'Q':
      case'q':
      case'K':
      case'k':
         val1=10;
      break;
       case'A':
       case'a':
         val1=1;
      break;
      default:
      val1=atoi(card1);
  }

  printf("This poker %s value is %d \n",card1,val1);
  
  printf("please input the second poker number \n");
  scanf("%s",card2);
 switch(card2[0])
  {
      case'J':
      case'j':
      case'Q':
      case'q':
      case'K':
      case'k':
         val2=10;
      break;
       case'A':
       case'a':
         val2=1;
      break;
      default:
      val2=atoi(card2);
  }
  printf("This poker %s value is %d \n",card2,val2);

  printf ("please input the third poker number  \n");
  scanf("%s",card3);
 switch(card3[0])
  {
      case'J':
      case'j':
      case'Q':
      case'q':
      case'K':
      case'k':
         val3=10;
      break;
       case'A':
       case'a':
         val3=1;
      break;
      default:
      val3=atoi(card3);
  }
printf("This poker %s value is %d \n",card3,val3);
 
  sum = val1 + val2 + val3 ;
 
  if(sum <=21)
    {
    if(val1==1||val2==1||val3 ==1 && sum+10<=21)
    printf("When A is 11,your scores in this game are %d ,\n WIN\n",sum+10);
    else
    printf("Your scores in this game are %d ,\n WIN\n",sum);
    }
 else
    printf("LOSE GAME\n");
  
  printf("Whether to start the game again?\n if yes please printf 1,if no please printf 2.\n ");
  scanf("%d",&choose);
  }
while (choose==1);
printf("Program wxited");
    
    return 0;
}